package com.isn.atencionemergencia.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author pool
 */
@Entity
@Table(name = "accidente")
public class Accidente implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "Cod_Acci", columnDefinition="CHAR(5) unsigned")
    private String codAcci;
    @Column(name = "Desc_Acci")
    private String descAcci;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "codAcci")
    private Collection<ResultadoDeOrdenDeAtencionDeEmergencia> resultadoDeOrdenDeAtencionDeEmergenciaCollection;

    public Accidente() {
    }

    public Accidente(String codAcci) {
        this.codAcci = codAcci;
    }

    public String getCodAcci() {
        return codAcci;
    }

    public void setCodAcci(String codAcci) {
        this.codAcci = codAcci;
    }

    public String getDescAcci() {
        return descAcci;
    }

    public void setDescAcci(String descAcci) {
        this.descAcci = descAcci;
    }

    @XmlTransient
    public Collection<ResultadoDeOrdenDeAtencionDeEmergencia> getResultadoDeOrdenDeAtencionDeEmergenciaCollection() {
        return resultadoDeOrdenDeAtencionDeEmergenciaCollection;
    }

    public void setResultadoDeOrdenDeAtencionDeEmergenciaCollection(Collection<ResultadoDeOrdenDeAtencionDeEmergencia> resultadoDeOrdenDeAtencionDeEmergenciaCollection) {
        this.resultadoDeOrdenDeAtencionDeEmergenciaCollection = resultadoDeOrdenDeAtencionDeEmergenciaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codAcci != null ? codAcci.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Accidente)) {
            return false;
        }
        Accidente other = (Accidente) object;
        if ((this.codAcci == null && other.codAcci != null) || (this.codAcci != null && !this.codAcci.equals(other.codAcci))) {
            return false;
        }
        return true;
    }
   
}
